package com.ruoyi.project.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.Xueshengchutable;
import com.ruoyi.project.system.service.IXueshengchutableService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 学生管理Controller
 * 
 * @author ruoyi
 * @date 2021-10-24
 */
@RestController
@RequestMapping("/system/xueshengchutable")
public class XueshengchutableController extends BaseController
{
    @Autowired
    private IXueshengchutableService xueshengchutableService;

    /**
     * 查询学生管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:xueshengchutable:list')")
    @GetMapping("/list")
    public TableDataInfo list(Xueshengchutable xueshengchutable)
    {
        startPage();
        List<Xueshengchutable> list = xueshengchutableService.selectXueshengchutableList(xueshengchutable);
        return getDataTable(list);
    }

    /**
     * 导出学生管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:xueshengchutable:export')")
    @Log(title = "学生管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Xueshengchutable xueshengchutable)
    {
        List<Xueshengchutable> list = xueshengchutableService.selectXueshengchutableList(xueshengchutable);
        ExcelUtil<Xueshengchutable> util = new ExcelUtil<Xueshengchutable>(Xueshengchutable.class);
        return util.exportExcel(list, "学生管理数据");
    }

    /**
     * 获取学生管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:xueshengchutable:query')")
    @GetMapping(value = "/{uid}")
    public AjaxResult getInfo(@PathVariable("uid") String uid)
    {
        return AjaxResult.success(xueshengchutableService.selectXueshengchutableByUid(uid));
    }

    /**
     * 新增学生管理
     */
    @PreAuthorize("@ss.hasPermi('system:xueshengchutable:add')")
    @Log(title = "学生管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Xueshengchutable xueshengchutable)
    {
        return toAjax(xueshengchutableService.insertXueshengchutable(xueshengchutable));
    }

    /**
     * 修改学生管理
     */
    @PreAuthorize("@ss.hasPermi('system:xueshengchutable:edit')")
    @Log(title = "学生管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Xueshengchutable xueshengchutable)
    {
        return toAjax(xueshengchutableService.updateXueshengchutable(xueshengchutable));
    }

    /**
     * 删除学生管理
     */
    @PreAuthorize("@ss.hasPermi('system:xueshengchutable:remove')")
    @Log(title = "学生管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{uids}")
    public AjaxResult remove(@PathVariable String[] uids)
    {
        return toAjax(xueshengchutableService.deleteXueshengchutableByUids(uids));
    }
}
